package com.proposition.commons.exam.util;

import com.baomidou.mybatisplus.enums.SqlLike;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.proposition.commons.exam.exception.ExamException;
import com.proposition.commons.exam.result.Result;
import com.proposition.commons.exam.result.ResultEnum;
import com.proposition.commons.model.*;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.subject.Subject;

import java.util.List;

/**
 * @Author: 陈玉林
 * @Description: 试题管理工具
 * @Date: Create In 14:24 2017/8/11
 * @ModifiedBy:
 */
public class ExamManageUtil {
    /**
     * @Author: 陈玉林
     * @Date: 2017/8/11 14:27
     * @Description: 试题审核验证权限
     * 1 若是“未审核”或者“一审未过”，则判断是否具有具有一审权限
     * 2 若是“一审通过”或者“二审未过”或者“二审通过”，则判断是否具有二审的权限
     */
    public static Result volidateAuthorizationForExamCheckOrUpdate(String checkStatus) {
        Result authorityResult = null;
        if (checkStatus != null) {
            Subject currentUser = SecurityUtils.getSubject();
            if (checkStatus.equals("未审核") || checkStatus.equals("一审未过")) {
                if (!currentUser.isPermitted("check_one_exam")) {
                    authorityResult = new Result();
                    authorityResult.setCode(ResultEnum.ILLEGAL_AUTHORITY.getCode());
                    authorityResult.setMsg(ResultEnum.ILLEGAL_AUTHORITY.getMsg());
                }
            } else if (checkStatus.equals("一审通过") || checkStatus.equals("二审未过") || checkStatus.equals("二审通过")) {
                if (!currentUser.isPermitted("check_two_exam")) {
                    authorityResult = new Result();
                    authorityResult.setCode(ResultEnum.ILLEGAL_AUTHORITY.getCode());
                    authorityResult.setMsg(ResultEnum.ILLEGAL_AUTHORITY.getMsg());
                }
            }
        }
        return authorityResult;
    }

    /**
     * 穴位点我-成人穴位
     * 将终极表试题的值给予一审表试题
     *
     * @param exam1 终极表试题
     * @param exam2 一审表试题
     * @return
     */
    public static ExamAcupointAdultCheck1 setValueIntoExamCheck1(ExamAcupointAdult exam1, ExamAcupointAdultCheck1 exam2) {

        exam2.setId(exam1.getId());
        exam2.setStem(exam1.getStem());
        exam2.setTotalScore(exam1.getTotalScore());
        exam2.setCheckStatusId(exam1.getCheckStatusId());
        exam2.setCategoryId(exam1.getCategoryId());
        exam2.setOutlineCode(exam1.getOutlineCode());
        exam2.setKnowledgePoint(exam1.getKnowledgePoint());
        exam2.setCognitiveLevel(exam1.getCognitiveLevel());
        exam2.setUserIdImport(exam1.getUserIdImport());
        exam2.setUserIdCheck1(exam1.getUserIdCheck1());
        exam2.setCheckRemark(exam1.getCheckRemark());
        exam2.setPartIdAdult(exam1.getPartIdAdult());
        exam2.setPartScoreAdult(exam1.getPartScoreAdult());
        exam2.setMeridianAdult(exam1.getMeridianAdult());
        exam2.setMeridianScoreAdult(exam1.getMeridianScoreAdult());
        exam2.setLocation1Adult(exam1.getLocation1Adult());
        exam2.setLocation2Adult(exam1.getLocation2Adult());
        exam2.setLocation3Adult(exam1.getLocation3Adult());
        exam2.setLocation1ScoreAdult(exam1.getLocation1ScoreAdult());
        exam2.setLocation2ScoreAdult(exam1.getLocation2ScoreAdult());
        exam2.setLocation3ScoreAdult(exam1.getLocation3ScoreAdult());
        return exam2;
    }

    /**
     * 穴位点我-儿科穴位
     * 将终极表试题的值给予一审表试题
     *
     * @param exam1 终极表试题
     * @param exam2 一审表试题
     * @return
     */
    public static ExamAcupointPediatricCheck1 setValueIntoExamCheck1(ExamAcupointPediatric exam1, ExamAcupointPediatricCheck1 exam2) {
        exam2.setId(exam1.getId());
        exam2.setStem(exam1.getStem());
        exam2.setTotalScore(exam1.getTotalScore());
        exam2.setCheckStatusId(exam1.getCheckStatusId());
        exam2.setCategoryId(exam1.getCategoryId());
        exam2.setOutlineCode(exam1.getOutlineCode());
        exam2.setKnowledgePoint(exam1.getKnowledgePoint());
        exam2.setCognitiveLevel(exam1.getCognitiveLevel());
        exam2.setUserIdImport(exam1.getUserIdImport());
        exam2.setUserIdCheck1(exam1.getUserIdCheck1());
        exam2.setCheckRemark(exam1.getCheckRemark());
        exam2.setPartIdPediatric(exam1.getPartIdPediatric());
        exam2.setPartScorePediatric(exam1.getPartScorePediatric());
        exam2.setPartDetailPediatric(exam1.getPartDetailPediatric());
        exam2.setPartDetailScorePediatric(exam1.getPartDetailScorePediatric());
        exam2.setLocation1Pediatric(exam1.getLocation1Pediatric());
        exam2.setLocation2Pediatric(exam1.getLocation2Pediatric());
        exam2.setLocation3Pediatric(exam1.getLocation3Pediatric());
        exam2.setLocation1ScorePediatric(exam1.getLocation1ScorePediatric());
        exam2.setLocation2ScorePediatric(exam1.getLocation2ScorePediatric());
        exam2.setLocation3ScorePediatric(exam1.getLocation3ScorePediatric());
        return exam2;
    }

    /**
     * 问答题-腧穴
     * 将终极表试题的值给予一审表试题
     *
     * @param exam1 终极表试题
     * @param exam2 一审表试题
     * @return
     */
    public static ExamAcupointCheck1 setValueIntoExamCheck1(ExamAcupoint exam1, ExamAcupointCheck1 exam2) {
        exam2.setId(exam1.getId());
        exam2.setStem(exam1.getStem());
        exam2.setTotalScore(exam1.getTotalScore());
        exam2.setCheckStatusId(exam1.getCheckStatusId());
        exam2.setCategoryId(exam1.getCategoryId());
        exam2.setOutlineCode(exam1.getOutlineCode());
        exam2.setKnowledgePoint(exam1.getKnowledgePoint());
        exam2.setCognitiveLevel(exam1.getCognitiveLevel());
        exam2.setUserIdImport(exam1.getUserIdImport());
        exam2.setUserIdCheck1(exam1.getUserIdCheck1());
        exam2.setCheckRemark(exam1.getCheckRemark());
        exam2.setLocation1(exam1.getLocation1());
        exam2.setLocation2(exam1.getLocation2());
        exam2.setLocation3(exam1.getLocation3());
        exam2.setLocation1Score(exam1.getLocation1Score());
        exam2.setLocation2Score(exam1.getLocation2Score());
        exam2.setLocation3Score(exam1.getLocation3Score());
        exam2.setMeridian(exam1.getMeridian());
        exam2.setMeridianScore(exam1.getMeridianScore());
        exam2.setMayorCure1(exam1.getMayorCure1());
        exam2.setMayorCure2(exam1.getMayorCure2());
        exam2.setMayorCure3(exam1.getMayorCure3());
        exam2.setMayorCure4(exam1.getMayorCure4());
        exam2.setMayorCure5(exam1.getMayorCure5());
        exam2.setMayorCure6(exam1.getMayorCure6());
        exam2.setMayorCure7(exam1.getMayorCure7());
        exam2.setMayorCure8(exam1.getMayorCure8());
        exam2.setMayorCure1Score(exam1.getMayorCure1Score());
        exam2.setMayorCure2Score(exam1.getMayorCure2Score());
        exam2.setMayorCure3Score(exam1.getMayorCure3Score());
        exam2.setMayorCure4Score(exam1.getMayorCure4Score());
        exam2.setMayorCure5Score(exam1.getMayorCure5Score());
        exam2.setMayorCure6Score(exam1.getMayorCure6Score());
        exam2.setMayorCure7Score(exam1.getMayorCure7Score());
        exam2.setMayorCure8Score(exam1.getMayorCure8Score());
        return exam2;
    }

    /**
     * 十条答案
     * 将终极表试题的值给予一审表试题
     *
     * @param exam1 终极表试题
     * @param exam2 一审表试题
     * @return
     */
    public static ExamAnswer10Check1 setValueIntoExamCheck1(ExamAnswer10 exam1, ExamAnswer10Check1 exam2) {
        exam2.setId(exam1.getId());
        exam2.setStem(exam1.getStem());
        exam2.setTotalScore(exam1.getTotalScore());
        exam2.setCheckStatusId(exam1.getCheckStatusId());
        exam2.setCategoryId(exam1.getCategoryId());
        exam2.setOutlineCode(exam1.getOutlineCode());
        exam2.setKnowledgePoint(exam1.getKnowledgePoint());
        exam2.setCognitiveLevel(exam1.getCognitiveLevel());
        exam2.setUserIdImport(exam1.getUserIdImport());
        exam2.setUserIdCheck1(exam1.getUserIdCheck1());
        exam2.setCheckRemark(exam1.getCheckRemark());
        exam2.setAnswer1(exam1.getAnswer1());
        exam2.setAnswer2(exam1.getAnswer2());
        exam2.setAnswer3(exam1.getAnswer3());
        exam2.setAnswer4(exam1.getAnswer4());
        exam2.setAnswer5(exam1.getAnswer5());
        exam2.setAnswer6(exam1.getAnswer6());
        exam2.setAnswer7(exam1.getAnswer7());
        exam2.setAnswer8(exam1.getAnswer8());
        exam2.setAnswer9(exam1.getAnswer9());
        exam2.setAnswer10(exam1.getAnswer10());
        exam2.setAnswer1Score(exam1.getAnswer1Score());
        exam2.setAnswer2Score(exam1.getAnswer2Score());
        exam2.setAnswer3Score(exam1.getAnswer3Score());
        exam2.setAnswer4Score(exam1.getAnswer4Score());
        exam2.setAnswer5Score(exam1.getAnswer5Score());
        exam2.setAnswer6Score(exam1.getAnswer6Score());
        exam2.setAnswer7Score(exam1.getAnswer7Score());
        exam2.setAnswer8Score(exam1.getAnswer8Score());
        exam2.setAnswer9Score(exam1.getAnswer9Score());
        exam2.setAnswer10Score(exam1.getAnswer10Score());
        return exam2;
    }

    /**
     * 三十条答案
     * 将终极表试题的值给予一审表试题
     *
     * @param exam1 终极表试题
     * @param exam2 一审表试题
     * @return
     */
    public static ExamAnswer30Check1 setValueIntoExamCheck1(ExamAnswer30 exam1, ExamAnswer30Check1 exam2) {
        exam2.setId(exam1.getId());
        exam2.setStem(exam1.getStem());
        exam2.setTotalScore(exam1.getTotalScore());
        exam2.setCheckStatusId(exam1.getCheckStatusId());
        exam2.setCategoryId(exam1.getCategoryId());
        exam2.setOutlineCode(exam1.getOutlineCode());
        exam2.setKnowledgePoint(exam1.getKnowledgePoint());
        exam2.setCognitiveLevel(exam1.getCognitiveLevel());
        exam2.setUserIdImport(exam1.getUserIdImport());
        exam2.setUserIdCheck1(exam1.getUserIdCheck1());
        exam2.setCheckRemark(exam1.getCheckRemark());
        exam2.setAnswer1(exam1.getAnswer1());
        exam2.setAnswer2(exam1.getAnswer2());
        exam2.setAnswer3(exam1.getAnswer3());
        exam2.setAnswer4(exam1.getAnswer4());
        exam2.setAnswer5(exam1.getAnswer5());
        exam2.setAnswer6(exam1.getAnswer6());
        exam2.setAnswer7(exam1.getAnswer7());
        exam2.setAnswer8(exam1.getAnswer8());
        exam2.setAnswer9(exam1.getAnswer9());
        exam2.setAnswer10(exam1.getAnswer10());
        exam2.setAnswer11(exam1.getAnswer11());
        exam2.setAnswer12(exam1.getAnswer12());
        exam2.setAnswer13(exam1.getAnswer13());
        exam2.setAnswer14(exam1.getAnswer14());
        exam2.setAnswer15(exam1.getAnswer15());
        exam2.setAnswer16(exam1.getAnswer16());
        exam2.setAnswer17(exam1.getAnswer17());
        exam2.setAnswer18(exam1.getAnswer18());
        exam2.setAnswer19(exam1.getAnswer19());
        exam2.setAnswer20(exam1.getAnswer20());
        exam2.setAnswer21(exam1.getAnswer21());
        exam2.setAnswer22(exam1.getAnswer22());
        exam2.setAnswer23(exam1.getAnswer23());
        exam2.setAnswer24(exam1.getAnswer24());
        exam2.setAnswer25(exam1.getAnswer25());
        exam2.setAnswer26(exam1.getAnswer26());
        exam2.setAnswer27(exam1.getAnswer27());
        exam2.setAnswer28(exam1.getAnswer28());
        exam2.setAnswer29(exam1.getAnswer29());
        exam2.setAnswer30(exam1.getAnswer30());
        exam2.setAnswer1Score(exam1.getAnswer1Score());
        exam2.setAnswer2Score(exam1.getAnswer2Score());
        exam2.setAnswer3Score(exam1.getAnswer3Score());
        exam2.setAnswer4Score(exam1.getAnswer4Score());
        exam2.setAnswer5Score(exam1.getAnswer5Score());
        exam2.setAnswer6Score(exam1.getAnswer6Score());
        exam2.setAnswer7Score(exam1.getAnswer7Score());
        exam2.setAnswer8Score(exam1.getAnswer8Score());
        exam2.setAnswer9Score(exam1.getAnswer9Score());
        exam2.setAnswer10Score(exam1.getAnswer10Score());
        exam2.setAnswer11Score(exam1.getAnswer11Score());
        exam2.setAnswer12Score(exam1.getAnswer12Score());
        exam2.setAnswer13Score(exam1.getAnswer13Score());
        exam2.setAnswer14Score(exam1.getAnswer14Score());
        exam2.setAnswer15Score(exam1.getAnswer15Score());
        exam2.setAnswer16Score(exam1.getAnswer16Score());
        exam2.setAnswer17Score(exam1.getAnswer17Score());
        exam2.setAnswer18Score(exam1.getAnswer18Score());
        exam2.setAnswer19Score(exam1.getAnswer19Score());
        exam2.setAnswer20Score(exam1.getAnswer20Score());
        exam2.setAnswer21Score(exam1.getAnswer21Score());
        exam2.setAnswer22Score(exam1.getAnswer22Score());
        exam2.setAnswer23Score(exam1.getAnswer23Score());
        exam2.setAnswer24Score(exam1.getAnswer24Score());
        exam2.setAnswer25Score(exam1.getAnswer25Score());
        exam2.setAnswer26Score(exam1.getAnswer26Score());
        exam2.setAnswer27Score(exam1.getAnswer27Score());
        exam2.setAnswer28Score(exam1.getAnswer28Score());
        exam2.setAnswer29Score(exam1.getAnswer29Score());
        exam2.setAnswer30Score(exam1.getAnswer30Score());
        return exam2;
    }

    /**
     * @author: 陈玉林
     * @date: 2017/12/25 10:47
     * @description: 进入试题修改页面前验证权限
     */
    public static void volidateAuthIntoExamUpdatePage(String id) {
        ExamUtil.volidateAuthorization("stxg");
    }

    //判断该试题是否组卷
    public static void isInPaper(String id) {
        PaperExam paperExam = new PaperExam();
        List<PaperExam> paperExams = paperExam.selectList(new EntityWrapper().like("exam1", id, SqlLike.DEFAULT).or().like("exam2", id, SqlLike.DEFAULT).or().like("exam3", id, SqlLike.DEFAULT));
        if (paperExams.size() > 0) {
            throw new ExamException(ResultEnum.IS_IN_PAPER_ALREADY);
        }
    }

    //验证试题审核权限
    public static void volidateExamCheckPermission(Integer categoryId, Integer checkStatusId) {
        Subject currentUser = SecurityUtils.getSubject();
        if (checkStatusId == 1 || checkStatusId == 2) {
            switch (categoryId) {
                case 1:
                    if (!currentUser.isPermitted("sx_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 2:
                    if (!currentUser.isPermitted("nk_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 3:
                    if (!currentUser.isPermitted("sk_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 4:
                    if (!currentUser.isPermitted("fk_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 5:
                    if (!currentUser.isPermitted("ek_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 6:
                    if (!currentUser.isPermitted("cz_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 7:
                    if (!currentUser.isPermitted("ekxw_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 8:
                    if (!currentUser.isPermitted("crxw_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 9:
                    if (!currentUser.isPermitted("eksf_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 10:
                    if (!currentUser.isPermitted("crsf_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 11:
                    if (!currentUser.isPermitted("czzd_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 12:
                    if (!currentUser.isPermitted("nkct_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 13:
                    if (!currentUser.isPermitted("skct_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 14:
                    if (!currentUser.isPermitted("fkct_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 15:
                    if (!currentUser.isPermitted("ekct_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 16:
                    if (!currentUser.isPermitted("kghxw_ys")) {
                        throw new AuthorizationException();
                    }
                    break;

                default:
                    break;

            }
        } else if (checkStatusId == 3 || checkStatusId == 4) {
            switch (categoryId) {
                case 1:
                    if (!currentUser.isPermitted("sx_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 2:
                    if (!currentUser.isPermitted("nk_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 3:
                    if (!currentUser.isPermitted("sk_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 4:
                    if (!currentUser.isPermitted("fk_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 5:
                    if (!currentUser.isPermitted("ek_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 6:
                    if (!currentUser.isPermitted("cz_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 7:
                    if (!currentUser.isPermitted("ekxw_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 8:
                    if (!currentUser.isPermitted("crxw_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 9:
                    if (!currentUser.isPermitted("eksf_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 10:
                    if (!currentUser.isPermitted("crsf_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 11:
                    if (!currentUser.isPermitted("czzd_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 12:
                    if (!currentUser.isPermitted("nkct_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 13:
                    if (!currentUser.isPermitted("skct_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 14:
                    if (!currentUser.isPermitted("fkct_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 15:
                    if (!currentUser.isPermitted("ekct_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 16:
                    if (!currentUser.isPermitted("kghxw_es")) {
                        throw new AuthorizationException();
                    }
                    break;

                default:
                    break;

            }
        }

    }

    //验证试题撤销审核权限
    public static void volidateExamCheckCancelPermission(Integer categoryId, Integer checkStatusId) {
        Subject currentUser = SecurityUtils.getSubject();
        if (checkStatusId == 0) {
            switch (categoryId) {
                case 1:
                    if (!currentUser.isPermitted("sx_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 2:
                    if (!currentUser.isPermitted("nk_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 3:
                    if (!currentUser.isPermitted("sk_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 4:
                    if (!currentUser.isPermitted("fk_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 5:
                    if (!currentUser.isPermitted("ek_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 6:
                    if (!currentUser.isPermitted("cz_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 7:
                    if (!currentUser.isPermitted("ekxw_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 8:
                    if (!currentUser.isPermitted("crxw_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 9:
                    if (!currentUser.isPermitted("eksf_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 10:
                    if (!currentUser.isPermitted("crsf_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 11:
                    if (!currentUser.isPermitted("czzd_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 12:
                    if (!currentUser.isPermitted("nkct_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 13:
                    if (!currentUser.isPermitted("skct_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 14:
                    if (!currentUser.isPermitted("fkct_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 15:
                    if (!currentUser.isPermitted("ekct_ys")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 16:
                    if (!currentUser.isPermitted("kghxw_ys")) {
                        throw new AuthorizationException();
                    }
                    break;

                default:
                    break;
            }
        } else if (checkStatusId == 2) {
            switch (categoryId) {
                case 1:
                    if (!currentUser.isPermitted("sx_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 2:
                    if (!currentUser.isPermitted("nk_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 3:
                    if (!currentUser.isPermitted("sk_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 4:
                    if (!currentUser.isPermitted("fk_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 5:
                    if (!currentUser.isPermitted("ek_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 6:
                    if (!currentUser.isPermitted("cz_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 7:
                    if (!currentUser.isPermitted("ekxw_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 8:
                    if (!currentUser.isPermitted("crxw_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 9:
                    if (!currentUser.isPermitted("eksf_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 10:
                    if (!currentUser.isPermitted("crsf_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 11:
                    if (!currentUser.isPermitted("czzd_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 12:
                    if (!currentUser.isPermitted("nkct_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 13:
                    if (!currentUser.isPermitted("skct_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 14:
                    if (!currentUser.isPermitted("fkct_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 15:
                    if (!currentUser.isPermitted("ekct_es")) {
                        throw new AuthorizationException();
                    }
                    break;
                case 16:
                    if (!currentUser.isPermitted("kghxw_es")) {
                        throw new AuthorizationException();
                    }
                    break;

                default:
                    break;

            }
        }
    }

    /**
     * @author: 陈玉林
     * @date: 2018/5/2 15:22
     * @description: 试题修改时判断一审详情权限
     */
    public static <T> boolean isUpdateCheckOne(String checkOnePermission, String checkTwoPermission,Integer checkStatus) {
        Subject currentUser = SecurityUtils.getSubject();
        // 只有一审权限
        if (currentUser.isPermitted(checkOnePermission) && !currentUser.isPermitted(checkTwoPermission)) {
            return true;
        }
        //如果是命题处长,根据审核状态判断
        if (currentUser.hasRole("admin") && checkStatus <= 2) {
            return true;
        }
        return false;
    }

    /**
     *@author: 陈玉林 
     *@date: 2018/5/3 9:35 
     *@description: 判断是否有进入试题管理权限
     */
    public static boolean hasIntoExamManagePage() {
        Subject currentUser = SecurityUtils.getSubject();
        boolean[] permitted = currentUser.isPermitted("sx_ys", "nk_ys","ek_ys","fk_ys","sk_ys","cz_ys","ekxw_ys","crxw_ys","kghxw_ys","eksf_ys","crsf_ys","czzd_ys","nkct_ys","skct_ys","fkct_ys","ekct_ys","sx_es", "nk_es","ek_es","fk_es","sk_es","cz_es","ekxw_es","crxw_es","kghxw_es","eksf_es","crsf_es","czzd_es","nkct_es","skct_es","fkct_es","ekct_es");
        for (boolean b:permitted) {
            if (b) {
                return true;
            }
        }
        return false;
    }
}
